package com.zzx.demo.service.impl;

import java.lang.reflect.Method;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.BeanFactoryAware;
import org.springframework.beans.factory.annotation.Autowired;

import com.zzx.api.IDemoService;
import com.zzx.demo.service.IBusiService;

public class DemoServiceImpl implements IDemoService,BeanFactoryAware{
	
	@Autowired
	private IBusiService busiService;
	
	private BeanFactory factory;
	public void setBeanFactory(BeanFactory factory) {
		this.factory = factory;
	}

	@Override
	public String rtnTest(String str) {
		System.err.println("************进入后台 busi start***********");
		execute(str);
		System.err.println("************进入后台 busi end**********");
		return "busi 层返回:"+str;
	}
	public String execute(String str) {
		String str2 = null;	    		
		try {
			Object object = factory.getBean("snsService");
			Method mth = object.getClass().getMethod("query", String.class);
			str2 = (String) mth.invoke(object, str );
		} catch (Exception e) {
			System.err.println("错误22"+e);
		}
	    		
			
		
		
		return str2;
	}
}
